#include <iostream>
#include <sqlite3.h>
#include <map>
#include <vector>

using namespace std;
class operation_db
{
public:
	operation_db(string dir);
	~operation_db();
	int execute_sql(char * sql);

	static int callback(void *data, int argc, char **argv, char **azColName);
	sqlite3 *getdb();
	int create_table();
	void get_colname();
	int insert(map<string, string> data);
	int del(int id, int checkdate);
	vector<map<string, string> > getdata(long int id, string name, int date);
	int update(long int id, int checkdate, map<string, string> data);
	int updateResult(long int id, int checkdate, string result);
	void set_map(map<string, string> &data);
	int run_sql(string tmp);
private:
	string path;
	sqlite3 *db;
	int rc;
	char *zErrMsg = 0;
	char** colname;

};
